#ifndef OPENGLEXCEPTION_H_INCLUDED
#define OPENGLEXCEPTION_H_INCLUDED

#include <string>
#include <Logger/GlobalLogger.h>

/// Functions checks for OpenGL errors and extract them from glGetError()
bool debug_check_glerrors(std::string msg);		// JUST LOGS.
void critical_check_glerrors(std::string msg);	// THROWS EXCEPTION.

// Compile time ennable/disable:

/// Do check as non critical.
#ifdef CV_LOG_DEBUG
#define CHECK_GLERRORS(X) (void)debug_check_glerrors(X)
#else
#define CHECK_GLERRORS(X) do { } while(0)
#endif

/// Do check as critical, possibly termainating the application.
#ifdef CV_LOG_CRITICAL
#define CRITICAL_CHECK_GLERRORS(X) critical_check_glerrors(X)
#else
#define CRITICAL_CHECK_GLERRORS(X) do { } while(0)
#endif


#endif // OPENGLEXCEPTION_H_INCLUDED
